<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/view/cms/theme/include/taglib.jsp" %>
<html>
<head>
    <title>${site.name}&&${category.name}</title>
    <%@ include file="head.jsp" %>
    <link rel="stylesheet" href="${ctxStatic}/faq/css/faq.css"/>
</head>
<body>
<%@ include file="header.jsp" %>
<div class="am-container">
    <div class="content" id="content">
        <!-- 模块排版 -->
        <div class="search-area-wrapper">
            <div class="search-area container">
                <h3 class="search-header">欢迎进入问答系统！</h3>
                <p class="search-tag-line">如果您有问题，请在下面提问，我们将会为您寻找答案!</p>

                <form id="search-form" class="search-form clearfix" method="get" autocomplete="off" novalidate="novalidate">
                    <c:set var="key" value="${fnc:urlDecode(param.key)}"></c:set>
                    <c:set var="searchKey" value="<span style=color:red;>${key}</span>"></c:set>
                    <input class="search-term required" type="text" name="key" placeholder="在这里输入您的问题" value="${key}" autocomplete="off">
                    <input class="search-btn" type="submit" value="搜索一下"> <input class="search-btn ask-btn" type="button" onclick="location.href='${ctxF}/${site.id}/${category.id}/view/faq-ask${urlSuffix}'" value="我要提问">
                    <div id="search-error-container"></div>
                </form>
            </div>
        </div>

        <div class="am-g">
            <c:set var="page" value='${faq:getFaqPage(param.key,param.pageNo, param.pageSize,"a.create_date desc")}'/>
            <div class="am-u-sm-8" style="padding: 0px;padding-right: 1.1em;">
                <div class="am-panel am-panel-default" style="margin-top:20px;">
                    <div class="title"><span>共${page.total}条问题</span></div>
                    <div class="am-form-group" style="float:right;margin-top:-20px;margin-right:20px;display:none;">
                        <label class="am-radio-inline"><input type="radio" name="faqType" checked> 最新的</label>
                        <label class="am-radio-inline"><input type="radio" name="faqType"> 已采纳的</label>
                        <label class="am-radio-inline"><input type="radio" name="faqType"> 未回答的</label>
                    </div>
                    <div class="am-panel-bd">
                        <div data-am-widget="list_news" class="am-list-news am-list-news-default" >
                            <div class="am-list-news-bd">
                                <ul class="am-list">
                                    <c:forEach items="${page.list}" var="question">
                                    <!--缩略图在标题左边-->
                                    <li class="am-g am-list-item-desced am-list-item-thumbed am-list-item-thumb-left" style="border-bottom: 1px solid #ddd;">
                                        <div class="am-u-sm-1 am-list-thumb">
                                            <a href="#link-to-user-home"><img src="${ctxStatic}/custom/images/user.png" class="am-comment-avatar" style="width:60px;height: 60px;"/></a>
                                        </div>
                                        <div class=" am-u-sm-11 am-list-main" style="padding-left:20px;">
                                            <h3 class="am-list-item-hd"><a href="${ctxF}/${site.id}/${category.id}/view/faq-detail${urlSuffix}?id=${question.id}">${fn:replace(question.title,key, searchKey)}</a></h3>
                                            <h3 class="am-list-item-hd">${fn:replace(question.content,key, searchKey)}</h3>
                                            <div class="am-list-item-text"><c:choose><c:when test="${question.hide}">匿名</c:when><c:otherwise>${empty question.user.name?question.user.username:question.user.name}</c:otherwise></c:choose> <fmt:formatDate value="${question.createDate}" pattern="yyyy-MM-dd"/> 回答（0）浏览（${question.views}）</div>
                                        </div>
                                    </li>
                                    </c:forEach>
                                </ul>
                            </div>
                        </div>

                    </div>
                </div>
            </div>
            <div class="am-u-sm-4" style="padding: 0px;">
                <div class="am-panel am-panel-default" style="margin-top: 20px;">
                    <div class="title"><span>活跃用户</span></div>
                    <div class="am-panel-bd masterlist">
                        <ul style="padding-left:0;">
                            <c:forEach items="${faq:getAnswersUserTop(10)}" var="userTop" varStatus="status">
                            <li>
                                <span><img src="<c:choose><c:when test="${empty userTop.photo}">${ctxStatic}/custom/images/user.png</c:when><c:otherwise>${userTop.photo}</c:otherwise></c:choose>" width="54" height="54"></span>
                                <span>${empty userTop.name?userTop.username:userTop.name}</span>
                                <%--<a href="#">问问TA</a>--%>
                                <span class="c1">回答&nbsp;${userTop.size}</span>
                            </li>
                            </c:forEach>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<%@ include file="footer.jsp" %>
</body>
</html>